/**
 * Generate code from /{{projectName}}-core/src/main/java/{{packageName}}/{{apis}}/rest/Abstract{{apiEntities}}Resource.java.hbs
 */
package cn.ibizlab.api.rest;

import java.util.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.http.HttpStatus;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.util.ObjectUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.access.prepost.PostAuthorize;
import org.springframework.validation.annotation.Validated;
import io.swagger.annotations.ApiOperation;
import cn.ibizlab.util.domain.ImportResult;
import cn.ibizlab.api.dto.*;
import cn.ibizlab.api.mapping.*;
import cn.ibizlab.core.authentication.domain.AuthUser;
import cn.ibizlab.core.authentication.service.AuthUserService;
import cn.ibizlab.core.authentication.filter.AuthUserSearchContext;

/**
 * 实体[AuthUser] rest实现
 *
 * @author generator
 */
@Slf4j
public abstract class AbstractAuthUserResource {

    @Autowired
    public AuthUserService authUserService;

    @Autowired
    @Lazy
    public AuthUserDTOMapping authUserDtoMapping;

    @Autowired
    @Lazy
    public AuthUserFilterDTOMapping authUserFilterDtoMapping;


    /**
    * LoadUserByUsername 认证用户
    * 
    *
    * @param id id
    * @return ResponseEntity<AuthUserDTO>
    */
    @ApiOperation(value = "LoadUserByUsername", tags = {"认证用户" },  notes = "AuthUser-LoadUserByUsername ")
    @GetMapping("auth_users/{id}/loaduserbyusername")
    public ResponseEntity<AuthUserDTO> loadUserByUsernameById
            (@PathVariable("id") String id) {
        AuthUser rt = authUserService.loadUserByUsername(id);
        return ResponseEntity.status(HttpStatus.OK).body(authUserDtoMapping.toDto(rt));
    }


}
